<include file="nav:headr"/>

    <div class="container">
        <div class="row">
            <div class="col-md-2">
                <a style="width: 150px" href="##" class="btn btn-primary"> باشقۇرغۇچىلار</a>
            </div>
            <div class="col-md-10">
                  <div class="page-header"><h4>ئەزالار تىزىملىكى</h4></div>
                <div class="btn-group" role="group" aria-label="...">
                    <a href="{:U('User/index')}" type="button" class="btn btn-default">بارلىق باشقۇرغۇچى</a>
                    <a href="{:U('User/add')}" type="button" class="btn btn-default">يېڭىدىن قوشۇش</a>
                </div>
                <br><br>
                <table class="table table-bordered">
                   <thead>
                        <tr class="active">
                            <td width="30">ID</td>
                            <td>ئېلىخەت</td>
                            <td>ئىسمى</td>
                            <td>تىزىملاتقان ۋاقىت</td>
                            <td>ھالىتى</td>
                            <td>مەشغۇلات</td>
                        </tr>
                   </thead>
                    <tbody>
                        <foreach name="users" item="u">
                            <tr>
                                <td>{$u['aid']}</td>
                                <td class="text-left" style="direction: ltr">{$u['email']}</td>
                                <td>{$u['auser']}</td>
                                <td class="text-left" style="direction: ltr">{$u['intime'] | date="Y-m-d H:i",###}</td>
                                <td>
                                    <if condition="$u['status']">
                                        <span class="label label-success">ئوچۇق</span>
                                        <else/>
                                        <span class="label label-danger">تاقاق</span>
                                    </if>
                                </td>
                                <td>
                                    <a href="{:U('User/edit',array('aid'=>$u['aid']))}" class="label label-success">تەھرىرلەش</a>
                                    <if condition="$_SESSION['name'] neq $u['aid']">
                                        <a href="javascript:deleteUser({$u['aid']});" class="label label-danger">ئۆچۈرۈش</a>
                                    </if>
                                </td>
                            </tr>
                        </foreach>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
<script type="text/javascript">
    //删除提示框
    function deleteUser(aid) {
        //询问框
        layer.confirm('راستىنلا ئۆچۈرەمسىز？', {
            btn: ['ھەئە','ياق'] //按钮
        }, function(){
            $.ajax({
                'url':"{:U('User/delete')}",
                'type':'POST',
                'dataType':'json',
                'data':{'aid':aid},
                success:function (phpRetrnData) {
                    console.log(phpRetrnData);
                    if(phpRetrnData.status){
                        layer.msg(phpRetrnData.message,{'icon':6},function () {
                            window.location=location;
                        })
                    }else {
                        layer.msg(phpRetrnData.message,{'icon':5});
                    }
                }
            })
        });
    }
</script>
<include file="nav:footer"/>